home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ABUSESRC.ZIP / AbuseSrc / abuse / src / help.c < prev    next >
C/C++ Source or Header  |  1996-04-11  |  1KB  |  49 lines

  1. #include "help.hpp"
  2. #include "game.hpp"
  3. #include "netcfg.hpp"
  4.  
  5. int total_help_screens;
  6. int *help_screens;
  7. static int help_page=0;
  8.  
  9. void fade_in(image *im, int steps);
  10. void fade_out(int steps);
  11.  
  12. void draw_help()
  13. {
  14.   image *im=cash.img(help_screens[help_page]);
  15.   int x1=xres/2-im->width()/2,y1=yres/2-im->height()/2;
  16.   int x2=x1+im->width(),y2=y1+im->height();
  17.   im->put_image(screen,x1,y1);
  18.   screen->bar(0,0,x1-1,yres,0);
  19.   screen->bar(0,0,xres,y1-1,0);
  20.   screen->bar(x2,y1,xres,yres,0);
  21.   screen->bar(x1,y2,x2,yres,0);
  22. }
  23.  
  24. void help_handle_event(event &ev)
  25. {
  26.   if (ev.window!=NULL) return ;
  27.   
  28.   if (the_game->state!=HELP_STATE)
  29.   {
  30.     if (ev.type==EV_KEY && (ev.key=='h' || ev.key=='?' || ev.key==JK_F1) && help_screens)
  31.     {
  32.       if (!main_net_cfg || (main_net_cfg->state!=net_configuration::SERVER && main_net_cfg->state!=net_configuration::CLIENT))
  33.       {
  34.     the_game->state=HELP_STATE;
  35.     help_page=0;
  36.       }
  37.     }
  38.   } else if (ev.type==EV_KEY)
  39.   {
  40.     if (ev.key==JK_ESC || help_page>=total_help_screens-1)
  41.     {
  42.       the_game->state=RUN_STATE;    
  43.       the_game->draw(0);
  44.     }
  45.     else
  46.       help_page++;
  47.   }    
  48. }
  49.